using System;
using System.IO;
using System.Security.Cryptography;

namespace Wantn.Share.DataCry
{
	public sealed class SHA1
	{
		public static byte[] Encrypt(byte[] data)
		{
			byte[] array = null;
			HashAlgorithm hashAlgorithm = null;
			try
			{
				hashAlgorithm = System.Security.Cryptography.SHA1.Create();
				return hashAlgorithm.ComputeHash(data);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				hashAlgorithm?.Clear();
			}
		}

		public static byte[] Encrypt(Stream data)
		{
			byte[] array = null;
			HashAlgorithm hashAlgorithm = null;
			try
			{
				hashAlgorithm = System.Security.Cryptography.SHA1.Create();
				return hashAlgorithm.ComputeHash(data);
			}
			catch (Exception ex)
			{
				throw ex;
			}
			finally
			{
				hashAlgorithm?.Clear();
			}
		}


	}
}
